%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Difraçao na dupla fenda infinitesimalmente fina.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;					Constant;
figure(1);				clf;

X =[-1:.01:1]*10e-6;	Y =[-.3:.01:1.7]*10e-6;	[x,y]=meshgrid(X,Y);
k =  5e6;				w =.05e6;					dt= 3e-6;	
d = 3e-6;

Ps2=exp(1i*k*sqrt((x-d).^2+y.^2))+exp(1i*k*sqrt((x+d).^2+y.^2));
%Ps2=exp(1i*k*sqrt((x-d).^2+y.^2))+exp(1i*k*sqrt((x).^2+y.^2))+exp(1i*k*sqrt((x+d).^2+y.^2));
Ps1=exp(1i*k*y);
Ps0=Ps1.*(y<0)+Ps2.*(y>0);

t=0;
for kk=1:500
	t=t+dt;
	Psi=Ps0*exp(-1i*w*t);
	
	surf(X*1e6,Y*1e6,real(Psi));
	shading flat;
	view([0 90]);
	axis off;
	axis equal;
	pause(.01)
end
